package sprites;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

public class RectangleSprite extends Sprite {

	public RectangleSprite(Point P, Dimension S) {
		super(P);
		setBounds(S);
	}
	
	private Dimension bounds;

	@Override
	public boolean containsPoint(Point P) {
		return (	P.x >= getPos().x 
				&&	P.y >= getPos().y 
				&&	P.x < getPos().x + getBounds().width
				&&	P.y < getPos().y + getBounds().height
				);
	}

	public Dimension getBounds() {
		return bounds;
	}

	public void setBounds(Dimension bounds) {
		this.bounds = bounds;
	}

	public void paintPoint(Graphics G, Rectangle R) {
		Color	oldColor = G.getColor();
		G.setColor(this.getColor());
		G.fill3DRect(R.x, R.y, R.width*this.bounds.width, R.height*this.bounds.height, true);
		G.setColor(oldColor);
	}

	@Override
	public String toXml() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void fromXml(String xml) {
		// TODO Auto-generated method stub
		
	}



}
